package com.ljb.http.retrofit.request;

import android.content.Context;

import com.ljb.http.logger.LogLevel;
import com.ljb.http.logger.Logger;
import com.ljb.http.logger.Settings;

/**
 * 对Retrofit初始化的操作,适合放到Application中
 * Created by lijianbin on 2016/12/16.
 */
public class RetrofitManager {

    public static void init(Context context, String baseURL) {
        initLogger(true);
        initRetrofit(context, baseURL);
    }

    private static void initRetrofit(Context context, String baseURL) {
        RetrofitRequest.getInstance().init(context, baseURL);
    }

    private static void initLogger(boolean isDebug) {
        Settings settings = Logger.init("RetrofitRequest");
        if (isDebug) {
            settings.logLevel(LogLevel.FULL);
        } else {
            settings.logLevel(LogLevel.NONE);
        }
//        settings.hideThreadInfo();
        settings.methodCount(1);

    }
}
